package strategy.demo;

import strategy.context.Context;
import strategy.strategy.impl.AddOperation;
import strategy.strategy.impl.MulOperation;
import strategy.strategy.impl.SubOperation;

public class Demo {
//    如果一个系统的策略多于四个，就需要考虑使用混合模式，解决策略类膨胀的问题
    public static void main(String[] args) {
        Context context = new Context(new AddOperation());
        System.out.println("10 + 5 = " + context.executeStrategy(10, 5));

        context = new Context(new SubOperation());
        System.out.println("10 - 5 = " + context.executeStrategy(10, 5));

        context = new Context(new MulOperation());
        System.out.println("10 * 5 = " + context.executeStrategy(10, 5));
    }
    }

